// #ifndef VUE3
import Vue from 'vue'
import App from './App'

Vue.config.productionTip = false

App.mpType = 'app'

const app = new Vue({
	...App
})
app.$mount()
// #endif

// #ifdef VUE3
import {
	createSSRApp
} from 'vue'
import App from './App.vue'
import util from "./common/tools/utils.js";
import uviewPlus, {
	setConfig
} from '@/uni_modules/uview-plus/index.js';
import * as Pinia from 'pinia';

import {
	usePageStore
} from "./common/tools/store.js"
import directiveThrottle from "./common/directive/throttle.js";
// #ifdef H5  
//H5平台通过index.html里面获取siteinfo
var siteInfo = window.siteinfo || {
	"uniacid": "2",
	"acid": "2",
	"multiid": "2",
	"version": "1.0.1",
	"siteroot": "http://localhost:20081/app/index.php",
	'method_design': '2',
	'openid': 45,
} /*调试时候这样用*/
// #endif 
//微信小程序里面通过require获取siteinfo 
// #ifdef MP-WEIXIN 
const siteInfo = require('./siteinfo.js');
// #endif 
//修改uviewplus的配置
 // setConfig({config:{unit: 'rpx'}});

export function createApp() {
	const app = createSSRApp(App)
	app.use(Pinia.createPinia());
	app.use(uviewPlus);
	//自定义节流防止按钮重复点击
	app.directive('throttle', directiveThrottle);
	
	app.use({
		install(Vue) {
			
			//Vue.directive
			const ee = usePageStore();
			ee.setConfig(siteInfo);
			//挂载到Vue属性		  
			Vue.config.globalProperties.ee = ee;
			Vue.config.globalProperties.kbutil = util;

		}
	})

	return {
		app,
		Pinia,
	}
}
// #endif